//
//  FmNetworking.h
//  FantasyMonster
//
//  Created by 冯志强 on 2024/1/29.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN


/**
 *  请求成功所走方法
 *
 *  @param responseObject 请求返还的数据
 */
typedef void (^FMResponseSuccess)(NSURLSessionDataTask * task,id responseObject,NSInteger code);

/**
 *  请求错误所走方法
 *
 *  @param error 请求错误返还的信息
 */
typedef void (^FMesponseFail)(NSURLSessionDataTask * task, NSError * error);


@interface FmNetworking : NSObject

+ (instancetype)shareInstance;

/**
    url                      :  请求地址
 params                      :  参数(可空)
 (ZuYResponseSuccess)success : 成功回调
 (ZYResponseFail)fail        : 失败回调
 */
-(void)POST:(NSString *)url
     params:(NSDictionary *__nullable)params
    success:(FMResponseSuccess)success
       fail:(FMesponseFail)fail;
/**
    url                      :  请求地址
 params                      :  参数(可空)
 (ZuYResponseSuccess)success : 成功回调
 (ZYResponseFail)fail        : 失败回调
 */
-(void)GET:(NSString *)url params:(NSDictionary *__nullable)params
 success:(FMResponseSuccess)success fail:(FMesponseFail)fail;

- (void)updateIdImage:(UIImage*)image url:(NSString *)url name:(NSString *)name
              success:(FMResponseSuccess)success fail:(FMesponseFail)fail;

@end

NS_ASSUME_NONNULL_END
